package com.un.ebs.customer.event;

import com.un.ebs.core.util.SpringContextUtil;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.context.ApplicationEvent;

import java.util.Date;

@SuppressWarnings("ALL")
@EqualsAndHashCode(callSuper = false)
@Data
public class CustomerTraceEvent extends ApplicationEvent {

    private String custId;

    private String typeDict;

    private String remindRemark;

    private String remark;

    private Date planDate;

    private String personnelId;


    public CustomerTraceEvent(Object source, String custId, String typeDict) {
        super(source);
        this.custId = custId;
        this.typeDict = typeDict;
    }

    public CustomerTraceEvent(Object source, String custId, String typeDict, String remark) {
        super(source);
        this.custId = custId;
        this.typeDict = typeDict;
        this.remark = remark;
    }

    public CustomerTraceEvent(Object source, String custId, String typeDict, Date planDate) {
        super(source);
        this.custId = custId;
        this.typeDict = typeDict;
        this.planDate = planDate;
    }

    public CustomerTraceEvent(Object source, String custId, String typeDict, String remark, Date planDate) {
        super(source);
        this.custId = custId;
        this.typeDict = typeDict;
        this.remindRemark = remark;
        this.planDate = planDate;
    }

    public CustomerTraceEvent(Object source, String custId, String personnelId, String typeDict, String remark, Date planDate) {
        super(source);
        this.custId = custId;
        this.personnelId = personnelId;
        this.typeDict = typeDict;
        this.remindRemark = remark;
        this.planDate = planDate;
    }

    public static void publishEvent(Object source, String custId, String typeDict) {
        CustomerTraceEvent event = new CustomerTraceEvent(source, custId, typeDict);
        SpringContextUtil.getApplicationContext().publishEvent(event);
    }

    public static void publishEvent(Object source, String custId, String typeDict, String remark) {
        CustomerTraceEvent event = new CustomerTraceEvent(source, custId, typeDict, remark);
        SpringContextUtil.getApplicationContext().publishEvent(event);
    }

    public static void publishEvent(Object source, String custId, String typeDict, Date planDate) {
        CustomerTraceEvent event = new CustomerTraceEvent(source, custId, typeDict, planDate);
        SpringContextUtil.getApplicationContext().publishEvent(event);
    }

    public static void publishEvent(Object source, String custId, String typeDict, String remark, Date planDate) {
        CustomerTraceEvent event = new CustomerTraceEvent(source, custId, typeDict, remark, planDate);
        SpringContextUtil.getApplicationContext().publishEvent(event);
    }

    public static void publishEvent(Object source, String custId, String personnelId, String typeDict, String remark, Date planDate) {
        CustomerTraceEvent event = new CustomerTraceEvent(source, custId, personnelId, typeDict, remark, planDate);
        SpringContextUtil.getApplicationContext().publishEvent(event);
    }
}
